/*
 * Copyright 2003-2005 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */

using System;
using TypeElement = argot.TypeElement;
using TypeException = argot.TypeException;
using TypeLibrary = argot.TypeLibrary;

namespace argot.meta
{
	
	public abstract class MetaBase 
	:TypeElement
	{
		public abstract System.String TypeName{get;}
		private TypeLibrary _library;
		private TypeElement _definition;
		private System.String _memberTypeName;
		private int _memberTypeId;
		private int _typeId;
		
		virtual public TypeLibrary Library
		{
			get
			{
				return _library;
			}
			
		}

		virtual public TypeElement TypeDefinition
		{
			get
			{
				return _definition;
			}
			
		}

		virtual public System.String MemberTypeName
		{
			get
			{
				return _memberTypeName;
			}
			
		}

		virtual public int MemberTypeId
		{
			get
			{
				return _memberTypeId;
			}
			
		}

		virtual public int TypeId
		{
			get
			{
				return _typeId;
			}
			
		}

		public virtual void Bind(TypeLibrary library, TypeElement definition, System.String memberTypeName, int memberTypeId)
		{
			_library = library;
			_definition = definition;
			_memberTypeName = memberTypeName;
			_memberTypeId = memberTypeId;
			_typeId = _library.GetId(TypeName);
		}
	}
}